global outb
global outw
global inb
global inw
global port_in
global port_out
global portw_in
global portw_out


outb:
	mov dx, [esp+4]
	mov al, [esp+8]
	out dx, al
	ret

outw:
  	mov dx, [esp+4]
	mov ax, [esp+8]
	out dx, ax
	ret
	
inb:  
	mov dx, [esp+4]
	in al, dx
	ret

inw:
	mov dx, [esp+4]
	in ax, dx
	ret

port_in:
	push ebp
	mov ebp, esp
	push dx	

	mov eax, 0
	mov dx, [ebp+8]
	in al, dx
	
	pop dx
	leave
	ret

port_out:
	push ebp
	mov ebp, esp
	pusha

	mov dx, [ebp+8]
	mov ax, [ebp+12]
	out dx, al
	
	popa
	leave
	ret
portw_in:
	push ebp
	mov ebp, esp
	push dx	

	mov eax, 0
	mov dx, [ebp+8]
	in ax, dx
	
	pop dx
	leave
	ret

portw_out:
	push ebp
	mov ebp, esp
	pusha

	mov dx, [ebp+8]
	mov ax, [ebp+12]
	out dx, ax
	
	popa
	leave
	ret
